package com.mai4j.maiadmin.controller.page.common;

import com.mai4j.maiadmin.support.I18nProvider;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 微信公众号请关注: 开源螺丝钉
 * <br>
 * 码云请关注: <a href="https://gitee.com/xiyoufang">https://gitee.com/xiyoufang</a>
 * <br>
 * 哔哩哔哩请关注: <a href="https://space.bilibili.com/438927834">https://space.bilibili.com/438927834</a>
 *
 * @author xiyoufang
 */
@RestController
@RequestMapping("/common/datatable")
public class DatatableController {

    @GetMapping({"/i18n"})
    public ResponseEntity<String> index(@RequestParam("tag") String tag) {
        // https://cdn.datatables.net/plug-ins/1.11.3/i18n/ 这里可以找到所有语言的翻译，注意 " 转义
        return ResponseEntity.ok()
                .body(I18nProvider.getByTag("text.datatable", tag));
    }
}
